/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.documentar.DAO;

/**
 *
 * @author Robertto
 */
public class ConfigBancoDadosDAO extends AbstractDAO {



    public boolean TestConnectionBancoDados(br.com.documentar.model.ConfigBancoDadosModel model) {
        AbstractDAO dao = new AbstractDAO(model.getOpcaoBancoDados(), model.getHost(), model.getBanco(), model.getPorta(), model.getUsuario(), model.getSenha());
        if (model.getOpcaoBancoDados().equals("MySql")) {
            model.setUsuario(super.getUsuarioBanco());
            model.setSenha(super.getSenhaBanco());
            if (dao.ConnectDataBase()) {
                dao.Desconectar(model.getNomeTela());
                return true;
            }
            return false;
        } else if (dao.ConnectDataBase()) {
            dao.Desconectar(model.getNomeTela());
            return true;
        } else {
            return false;
        }

    }

}
